const api = require('../utils/request.js')
import {request} from '../utils/request'

module.exports = {

   // 获取营地名称
   campListName(data) {
    return api.request({
      url: '/wechat/camp/listName',
      method: 'get',
      data
    })
  },
  goodsList(campId) {
    return api.request({
      url: '/wechat/goods/camp/' + campId,
      method: 'get',
    })
  },

  // 获取营地列表
  campList(data) {
    return api.request({
      url: '/wechat/camp/list',
      method: 'get',
      data
    })
  },
  //营地信息修改
  campUpInfo(params) {
    return api.request({
      url: '/wechat/camp',
      method: 'put',
      data: {
        "campId": "2e72e788-fc9b-4065-9820-0347116e7a7f",
        "address": params.address,
        "campName": params.campName,
        "campType": params.campType,
        "imageUrl": params.imageUrl.join(","),
        "introduce": params.introduce,
        "latitude": params.latitude,
        "location": params.location,
        "longitude": params.longitude,
        "linkman": params.linkman,
        "phone": params.phone,
        "specificTime": params.timeType,
        "userId": params.userId,
        "userType": params.userType
      }
    })
  },

  //营地营位添加
  campAddCampsite(data) {
    return api.request({
      url: '/wechat/campsite',
      method: 'post',
      data
    })
  },
  //营地营位删除
  campDelCampsite(campsiteId) {
    return api.request({
      url: '/wechat/campsite/' + campsiteId,
      method: 'delete'
    })
  },
  //营地营位根据id获取 /wechat/campsite/list
  getCampCampsite(data) {
    return api.request({
      url: '/wechat/campsite/list',
      method: 'GET',
      data
    })
  },

  // 景点添加
  addScenic(data) {
    return api.request({
      url: `/wechat/spots/add`,
      method: 'post',
      data
    })
  },
  // 景点删除
  campDelScenic(scenicId) {
    return api.request({
      url: '/wechat/spots/delete/' + scenicId,
      method: 'delete'
    })
  },
  // 活动添加
  addActivity(data) {
    return api.request({
      url: `/wechat/activity/add`,
      method: 'post',
      data
    })
  },
  // 项目删除
  campDelActivity(activityId) {
    return api.request({
      url: '/wechat/activity/delete/' + activityId,
      method: 'delete'
    })
  },
  // 项目添加
  addOtherProject(data) {
    return api.request({
      url: `/wechat/project/add`,
      method: 'post',
      data
    })
  },
  // 项目删除
  campDelProject(projectId) {
    return api.request({
      url: '/wechat/project/delete/' + projectId,
      method: 'delete'
    })
  },
  // 删除营地
  deleteCamp(campId) {
    return api.request({
      url: `/wechat/camp/${campId}`,
      method: 'delete'
    })
  },
  // 获取营位列表
  getCampsiteList: function (query) {
    return api.request(
      "/wechat/campsite/list",
      "get",
      query
    )
  },
  // 获取营地详细信息
  detailCamp(id) {
    return api.request({
      url: `/wechat/camp/${id}`
    })
  },
  
  // 查询该营地的服务设施列表
  seekList(id){
    return api.request({
      url: `/wechat/facility/getInfo/${id}`
    })
  },
  // 修改营地
  modifyCamp(data) {
    return request({
      url: "/wechat/camp",
      method: "POST",
      data
    })
  },

  updateState(data){
      return request({
        url: data,
        method: "PUT"
      })
  },



  //新增商品
  addgoods(goods){
    return request({
      url: "/wechat/goods",
      method: "POST",
      data: goods
    })
  },
  // 商品删除
  campDelGoods(goodsId) {
    return api.request({
      url: '/wechat/goods/delete/' + goodsId,
      method: 'delete'
    })
  },
  //租赁订单
  addOrder(data){
    return api.request({
      url: '/wechat/order/goods',
      method: 'post',
      data
    })
  },
  getOrder(data){
    return api.request({
      url: '/wechat/order/listOrder',
      method: 'GET',
      data
    })
  },
  delOrder(orderId){
    return api.request({
      url: '/wechat/order/by/' + orderId,
      method: 'DELETE'
    })
  }}

